<?php ob_start();
    include("mysql.php");
    $ver=mysql_query("SELECT * FROM message where class = '0' and visible = '1' order by time desc ");
    $row=mysql_query("SELECT * FROM message where id = (SELECT min(id) FROM message) ");
    $back=mysql_fetch_assoc($row);
        $maxx=$back['id'];
        $a=1;
    while(!empty($result=mysql_fetch_assoc($ver))){
            $id=$result['id'];
            $opid=$result['opid'];
            $code=0;
            $array=array();
            $pic=mysql_query("SELECT * FROM picture where follow = '$id' order by time asc ");
            while(!empty($picc=mysql_fetch_assoc($pic))){
                $array[]=$picc['url'];
            };
            $user=mysql_query("SELECT * FROM user where opid = '$opid' ");
            $use=mysql_fetch_assoc($user);
            $data=array(
                'opid'=>$result['opid'],
                'name'=>$use['name'],
                'port'=>$use['port'],
                'mes_text'=>$result['mes_text'],
                'time'=>$result['time'],
                'pic_url'=>$array
                );
	        	  $ret=array(
	        	      'code' => $code,
        		      'data' => $data,
        		  );
            header('Content-Type:application/json; charset=utf-8');
            if($a!=1){
                echo(',');
                //header('Content-Type:application/json; charset=utf-8');
                echo(json_encode($ret,JSON_UNESCAPED_UNICODE));
            }
            else{
                echo('[');
                header('Content-Type:application/json; charset=utf-8');
                echo(json_encode($ret,JSON_UNESCAPED_UNICODE));
                $a--;
            }
            
           
        
        
        
        
        // echo($result['id'].'/');
        // echo($result['mes_user'].'/');
        // echo($result['mes_text'].'/');
        // echo($result['time'].'/');
        // echo($result['class'].'<br/>');

    }
    echo(']');



?>